<?php
	// mysql_connect('localhost', 'root','123456') or die ('Could not connect to database');
 //    mysql_select_db('test') or die ('Could not select database');
try {
	$host = "localhost";
	$dbname = "management_cafe";
	$user = "root";
	$pass = "";
	$db = new PDO("mysql:host=".$host.";dbname=".$dbname,$user,$pass);

	// Thiết lập chế độ báo lỗi
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND,"SET NAMES utf8");
} catch (Exception $e) {
	    // Xử lý Exception
    echo "Bị lỗi rồi T_T.";
    file_put_contents('log.txt', $e->getMessage() . '\r\n', FILE_APPEND);
}
?>